package kr.pe.johnkim.waiting.mobile.dao;

import kr.pe.johnkim.waiting.mobile.domain.WaitingMerchant;
import org.mybatis.spring.support.SqlSessionDaoSupport;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Repository;

/**
 * @author : John_Kim <cale9797@gmail.com>
 * @date : 13. 5. 23.
 */
@Repository
public class WaitingMerchantDaoImpl extends SqlSessionDaoSupport implements WaitingMerchantDao {

    // SLF4J Logging
    private Logger logger = LoggerFactory.getLogger(WaitingMerchantDaoImpl.class);

    /**
     * 가맹점 정보를 가져 온다.
     *
     * @param waitingMerchant
     * @return
     */
    @Override
    public WaitingMerchant selectMerchantInformation(WaitingMerchant waitingMerchant) {
        logger.info("selectMerchantInformation");
        return (WaitingMerchant)this.getSqlSession().selectOne("WAITING_MERCHANTS.selectMerchantInformation", waitingMerchant);
    }

    /**
     * 가맹점 로그인을 한다.
     *
     * @param waitingMerchant
     * @return
     */
    @Override
    public WaitingMerchant login(WaitingMerchant waitingMerchant) {
        logger.info("login");
        return (WaitingMerchant)this.getSqlSession().selectOne("WAITING_MERCHANTS.login", waitingMerchant);
    }
}
